USE [AnotherSuccessfulProcedure]

IF EXISTS (SELECT * FROM sysobjects WHERE id = object_id(N'[dbo].[WeaponsStatsSelect]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
BEGIN
	DROP PROCEDURE dbo.WeaponsStatsSelect
END


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		Neil Wilson
-- Create date: 09/24/08
-- Description:	Weapons Table Stats Select
-- =============================================
CREATE PROCEDURE WeaponsStatsSelect

AS

BEGIN

	SELECT COUNT(Kills.Attacker_weaponId) AS [Kills], 0 AS [Deaths], 0.0 AS [KillDeathRatio], 0.0 AS [Headshot Percentage], WeaponId, WeaponShortName, WeaponFullName, ClassId FROM Weapons
	LEFT OUTER JOIN Kills on Kills.Attacker_weaponId = Weapons.WeaponId
	GROUP BY WeaponId, WeaponShortName, WeaponFullName, ClassId
	ORDER BY [Kills] DESC
	
END
GO


